
let utils = require('./util.js');


let tmpjsonpolygon = {
  "src_file_path":"",
}
let tmpjsonslt = {
  "input_file_path":"",
  "max_length":256
}
let tmpdir = 'D:/xiangmu/shujuguanli/tmpdir/'
let polygoncmd = 'D:/xiangmu/shujuguanli/ImageProperties/ImageProperties.exe '
let imgcmd = 'D:/xiangmu/shujuguanli/ImageProperties/Thumbnail.exe '

async function getDirList(params) {
  let res_arr =  utils.getAllFile(params)
  return res_arr
}

function beginDir(params) {
  
}



async function test(params) {

  let resnames = await getAllFile(inputdirpath)
  
  // let cmdstr = 'D:/xiangmu/shujuguanli/ImageProperties/ImageProperties.exe '
  
  resnames.map(item => {
    let cmdstr = polygoncmd

    tmpjson.src_file_path = item

    let tmpjsonrespath = tmpdir + '' + _.random(0, 9999999999) + '.json'
    fs.writeFileSync(tmpjsonrespath, JSON.stringify(tmpjson), 'utf8')
  
    cmdstr += tmpjsonrespath

    console.log(cmdstr);
  
    exec(cmdstr, (err, stdout, stderr) => {
      if (err) {
        console.error(err);
        return;
      }
      console.log(stdout);
    });
  })
}




exports.getDirList = getDirList
exports.beginDir = beginDir

